package com.kwlt.smc.web;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kwlt.smc.dao.UserChannelDao;
import com.kwlt.smc.util.CacheMap;

@Controller
@RequestMapping(value="/cache")
public class SmsCacheController {
	@Autowired
	private CacheMap cacheMap;
	
	@RequestMapping(value="updatePhoneThem")
	public void updatePhoneThem(HttpServletResponse response){
		PrintWriter out;
		try {
			cacheMap.updatePhoneThem();
			out = response.getWriter();
			out.print("0");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	@RequestMapping(value="updateBlack")
	public void updateBlack(HttpServletResponse response){
		PrintWriter out;
		try {
			cacheMap.updateBlackCache();
			out = response.getWriter();
			out.print("0");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	@RequestMapping(value="updateKeyword")
	public void updateKeyword(HttpServletResponse response){
		PrintWriter out;
		try {
			cacheMap.updateKeywordCache();
			out = response.getWriter();
			out.print("0");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	@RequestMapping(value="updateUser")
	public void updateUser(HttpServletResponse response){
		PrintWriter out;
		try {
			cacheMap.updateUserCache();
			out = response.getWriter();
			out.print("0");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	@RequestMapping(value="updateChannel")
	public void updateChannel(HttpServletResponse response){
		PrintWriter out;
		try {
			cacheMap.updateChannelCache();
			out = response.getWriter();
			out.print("0");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
